package cn.zdsoft.configuration.core.api;

import cn.zdsoft.configuration.core.exceptions.ConfigurationException;
import cn.zdsoft.configuration.core.listener.ZKListener;

import java.util.Properties;

/**
 * 配置客户端接口
 * Created by wangdongdong on 2018/5/14.
 */
public interface IConfigClient {

    /**
     * 初始化
     * @param properties
     */
    void init(Properties properties) throws ConfigurationException;

    /**
     * 获取所有配置
     * @return
     */
    Properties getConfig() throws ConfigurationException;

    /**
     * 获取指定key的值
     * @param propKey
     * @return
     */
    String getValue(String propKey) throws ConfigurationException;

    /**
     * 获取指定key的值
     * @param propKey
     * @return
     */
    String getValue(String propKey, ZKListener listener) throws ConfigurationException;

    /**
     * 注册监听器
     * @param listener
     */
    void registListener(ZKListener listener);

    /**
     * 注册回调函数
     * @param callbackAble
     */
    void registCallAble(CallbackAble callbackAble);

    /**
     * 关闭客户端
     */
    void close();
}
